dynamic_menu object
This method allows you to specify an existing sound object to be used for any auditory feedback in the menu.
bool set_sound_object(sound@ handle)
Parameters:
handle
A handle to an existing sound object that is to be used for all subsequent sound output.
Return value:
true on success, false on failure.
Remarks:
The object that you specify in this function will be used for all subsequent auditory feedback provided to the user in the menu. If you do not call this method and still use sound output, an internal sound object will be used instead.
Example:
// Make a simple menu with redirected sound playback.
#include "dynamic_menu.bgt"
void main()
{
sound my_sound;
dynamic_menu my_menu;
int menu_result;
my_menu.allow_escape=true;
my_menu.wrap=false;
my_menu.set_sound_object(my_sound);
my_menu.add_item("start_game.wav");
my_menu.add_item("test_speakers.wav");
my_menu.add_item("exit.wav");
menu_result=my_menu.run("choose_an_option.wav", false);
if(menu_result==-1)
{
alert("Error", "There was an error loading the menu.");
exit();
}
if(menu_result==0)
{
alert("Option", "Escape was pressed. Exiting.");
exit();
}
if(menu_result==1)
{
alert("Option", "Option selected was start game.");
}
if(menu_result==2)
{
alert("Option", "Option selected was test speakers.");
}
if(menu_result==3)
{
alert("Option", "Option selected was exit. Exiting.");
exit();
}
}